import Home from "../pages/home/home";
import Category from "../pages/home/category/category";
import Login from "../pages/login/login";
import Dashboard from "../pages/home/dashboard/dashboard";
import { Navigate } from "react-router-dom";
import { Children } from "react";
import User from "../pages/home/rbac/user/User";
import Role from "../pages/home/rbac/role/Role";
import Permissions from "../pages/home/rbac/permissions/Permissions"

const router:any=[
    //当访问/的时候，重定向到登录页面
    {
     path:'/',
     element:<Navigate to="/login"></Navigate>
    },
    //当访问/home的时候,重定向到/home/dashboard
    {
     path:'/login',
     element:<Login />
    },
    {
        path:'/home',
        element:<Navigate to="/home/dashboard" />
    },
    {
        path:'/home',
        element:<Home />,
        children:[
            {
                path:'/home/dashboard',
                element:<Dashboard />,
            },
            {
                path:'/home/category',
                element:<Category />,
            },
            {
                path:"/home/rbac",
                children:[
                  {
                    path:'/home/rbac/user',
                    element:<User />,
                   },
                   {
                    path:'/home/rbac/role',
                    element:<Role />,
                   },
                   {
                    path:'/home/rbac/menu',
                    element:<Permissions />,
                   },
                ]
            }
            
        ],
    },
];

export default router;